/* eslint valid-jsdoc: "off" */

"use strict"

module.exports = (appInfo) => {
  const config = (exports = {})
  config.keys = appInfo.name + "_karrys"
  config.middleware = []
  config.dirpath = "/app/public/avatar/upload"
  // 微信小程序信息配置
  config.wxApp = {
    book: {
      appid: "xx",
      secret: "xx",
    },
  }
  config.wechatPay = {
    client: {
      bodyPrefix: "", //
      appId: "xx", //微信公众号或小程序号
      merchantId: "x", //商户号
      secret: "x", //商户密钥
      notifyUrl: "", //支付成功回调地址
      REFUNDNotifyUrl: "", //退款成功回调地址
      // pfx: fs.readFileSync(
      //   path.join(__dirname, "../app/public/wxpaly/apiclient_cert.p12")
      // ), //退款证书地址
    },
  }

  const userConfig = {}
  userConfig.security = {
    csrf: false,
    domainWhiteList: ["http://localhost:9528"], //白名单IP无跨域问题
  }

  userConfig.jwtSecret = "karry"
  userConfig.mysql = {
    client: {
      host: "localhost",
      // host: "101.37.30.97",
      port: "3306",
      user: "root",
      // password: "litao1884873780",
      password: "root",
      database: "book",
    },
  }
  userConfig.multipart = {
    mode: "file",
    whitelist: [".png", ".jpeg", ".jpg", ".gif"],
    fileSize: "50mb",
  }
  return {
    ...config,
    ...userConfig,
  }
}
